package com.lxd.milktea.dataobject;

import javax.persistence.*;
import java.sql.Timestamp;

/**
 * @ProjectName: milktea
 * @Package: com.lxd.milktea.dataobject
 * @ClassName: Material
 * @Author: carrymaniac
 * @Description:
 * @Date: 2020/5/10 3:55 下午
 * @Version:
 */
@Entity
@Table(name = "tb_material", schema = "milk", catalog = "")
public class Material {
    private String id;
    private String materialName;
    private int stock;
    private String pic;
    private byte status;
    private Timestamp createTime;
    private Timestamp updateTime;

    @Id
    @Column(name = "id")
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    @Basic
    @Column(name = "materialName")
    public String getMaterialName() {
        return materialName;
    }

    public void setMaterialName(String materialName) {
        this.materialName = materialName;
    }

    @Basic
    @Column(name = "stock")
    public int getStock() {
        return stock;
    }

    public void setStock(int stock) {
        this.stock = stock;
    }

    @Basic
    @Column(name = "pic")
    public String getPic() {
        return pic;
    }

    public void setPic(String pic) {
        this.pic = pic;
    }

    @Basic
    @Column(name = "status")
    public byte getStatus() {
        return status;
    }

    public void setStatus(byte status) {
        this.status = status;
    }

    @Basic
    @Column(name = "create_time")
    public Timestamp getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Timestamp createTime) {
        this.createTime = createTime;
    }

    @Basic
    @Column(name = "update_time")
    public Timestamp getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Timestamp updateTime) {
        this.updateTime = updateTime;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Material material = (Material) o;

        if (stock != material.stock) return false;
        if (status != material.status) return false;
        if (id != null ? !id.equals(material.id) : material.id != null) return false;
        if (materialName != null ? !materialName.equals(material.materialName) : material.materialName != null)
            return false;
        if (pic != null ? !pic.equals(material.pic) : material.pic != null) return false;
        if (createTime != null ? !createTime.equals(material.createTime) : material.createTime != null) return false;
        if (updateTime != null ? !updateTime.equals(material.updateTime) : material.updateTime != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = id != null ? id.hashCode() : 0;
        result = 31 * result + (materialName != null ? materialName.hashCode() : 0);
        result = 31 * result + stock;
        result = 31 * result + (pic != null ? pic.hashCode() : 0);
        result = 31 * result + (int) status;
        result = 31 * result + (createTime != null ? createTime.hashCode() : 0);
        result = 31 * result + (updateTime != null ? updateTime.hashCode() : 0);
        return result;
    }
}
